home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 November / PCWNOV07.iso / Software / Freeware / NSIS 2.29 / nsis-2.29-setup.exe / Examples / UserVars.nsi < prev    next >
Encoding:
Text File  |  2005-08-06  |  1.3 KB  |  68 lines

  1. ; UserVars.nsi
  2. ;
  3. ; This script shows you how to declare and user variables.
  4.  
  5. ;--------------------------------
  6.  
  7.   Name "User Variables Text"
  8.   OutFile "UserVars.exe"
  9.   
  10.   InstallDir "$PROGRAMFILES\User Variables Test"
  11.   
  12. ;--------------------------------
  13.  
  14.   ;Pages
  15.   Page directory
  16.   Page instfiles
  17.   
  18.   UninstPage uninstConfirm
  19.   UninstPage instfiles
  20.  
  21. ;--------------------------------
  22. ; Declaration of user variables (Var command), allowed charaters for variables names : [a-z][A-Z][0-9] and '_'
  23.  
  24.   Var "Name"
  25.   Var "Serial"
  26.   Var "Info"
  27.  
  28. ;--------------------------------
  29. ; Installer
  30.  
  31. Section "Dummy Section" SecDummy
  32.  
  33.      StrCpy $0 "Admin"
  34.      StrCpy "$Name" $0
  35.      StrCpy "$Serial" "12345"
  36.      MessageBox MB_OK "User Name: $Name $\n$\nSerial Number: $Serial"
  37.  
  38.      CreateDirectory $INSTDIR
  39.      WriteUninstaller "$INSTDIR\Uninst.exe"
  40.      
  41. SectionEnd
  42.  
  43. Section "Another Section"
  44.  
  45.      Var /GLOBAL "AnotherVar"
  46.  
  47.      StrCpy $AnotherVar "test"
  48.  
  49. SectionEnd
  50.  
  51. ;--------------------------------
  52. ; Uninstaller
  53.  
  54. Section "Uninstall"
  55.  
  56.      StrCpy $Info "User variables test uninstalled successfully."
  57.      Delete "$INSTDIR\Uninst.exe"
  58.      RmDir $INSTDIR
  59.  
  60. SectionEnd
  61.  
  62. Function un.OnUninstSuccess
  63.  
  64.      HideWindow
  65.      MessageBox MB_OK "$Info"
  66.      
  67. FunctionEnd
  68.